from django.db import models
from django.contrib.auth.models import User
from django.utils.timezone import now
# Create your models here.


class Comment(models.Model):
        user = models.ForeignKey(User, verbose_name="评论用户", on_delete=models.CASCADE)
        text = models.TextField(verbose_name='评论的内容', default='很好')
        comment_time = models.DateTimeField(verbose_name='创建时间', default=now)
        post = models.ForeignKey('polls.Imgs', on_delete=models.DO_NOTHING, verbose_name="评论的文章")

        def __str__(self):
            return self.text[:50]



